import { environment } from './environments/environment';

class SafetyInfo {
    private key = 'scyysoft';
    
    private _appsecret: string;
    get appsecret() {
        return this._appsecret;
    }
    get token() {
        return window.localStorage.getItem(this.key);
    }
    /**
     *
     */
    constructor() {
    }
    setToken(token: string) {
        window.localStorage.setItem(this.key, token);
    }
    removeToken() {
        window.localStorage.removeItem(this.key);
    }
}

/**配置信息 */
class Config {
    /**是否是生产模式 */
    isProd: Boolean = environment.production;
    /**api 的地址 */
    apiprefix: string = environment.api;
    /** 图片在线预览的地址 */
    imgurl: string = environment.imgurl;
    /**Web端的版本号 */
    version: string = environment.version;
    outfallMap: string = environment.outfallMap;
    /** 文件上传的接口地址-单个上传 */
    fileupload: string;
    /** 文件上传的接口地址-多个上传 */
    fileuploads: string;
    /** 站点建设标准上传的接口地址 */
    webuploadfile: string;
    /** 图片下载地址 */
    imagedownurl: string;
    /** 图片上传地址 */
    imageuploadurl: string;

    safetyInfo: SafetyInfo;

    constructor() {
        this.safetyInfo = new SafetyInfo();
        this.fileupload = this.apiprefix + '/file/uploadfile/';
        this.fileuploads = this.apiprefix + '/file/uploadfiles/';
        this.webuploadfile = this.apiprefix + '/file/webuploadfile/';
        this.imagedownurl = this.apiprefix + '/file/imgdown/';
        this.imageuploadurl = this.apiprefix + '/file/imgupload/';
    }
}

/**配置 */
export const config = new Config();
